package com.swf.seed.triutil.lang;


import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.swf.seed.base.SdCharset;

public  class SdStringUtils extends StringUtils{
	private static final Logger logger = LoggerFactory
			.getLogger(SdStringUtils.class);
	public static String ISO2UTF8(String orgin){
		return ISO2Charst(orgin,SdCharset.UTF_8);
	}
	/**
	 * 
	 * @param orgin
	 * @param charset
	 * @return
	 */
	public static String ISO2Charst(String orgin,String charset){
		String target = orgin;
		try {
			target = new String(orgin.getBytes(SdCharset.ISO_8859_1), charset != null ? charset :SdCharset.defaultCharset);
		} catch (UnsupportedEncodingException e) {
			logger.error(e.getMessage(), e);
		}
		return target;
	}
	
}
